$(function(){
	_toAction();
	$(".menu").find("a").click(function(){
		//var url = window.location.href;
		var tourl = window.location.href.split("#")[0];
		window.location.href = tourl+$(this).attr("href");
		_toAction();
	});
	$("a[href=pop_close]").click(function(){
		$("#popup").css("display","none");
		$(".pop_main").html("");
		$(".pop_header > span").html("");
		window.location.href = window.location.href.split("#")[0];
		return false;
	});
});
function popup(c){
	$.ajax({
		url:"core/core.php?action="+c,
		type: "GET",
		dataType:"html",
		cache:false,
		timeout:2000,
		beforeSend:function(){
			$("#popup").css("display","block");
			$(".pop_main").html("<span class='pop_load'><img src='images/load.gif' /></span>");
		},
		success:function(msg){
			setTimeout("show('"+msg+"')",2000);
			$(".pop_header > span").html(c);
			//$(".pop_main").html(msg);
		},
		error:function(){
			alert("server error");
		}
	});
}
function show(msg){
	$(".pop_main").html(msg);
}

function _toAction(){ 
	var url = window.location.href;
	var reg = /#i:(?!\|)./;
	intIndex = reg.test(url);
	if (intIndex){
		var parameter = url.split("#")[1].split("|");
		var a = new Array();
		if (parameter.length == 0){
			alert("do nothing");
		} else {
			for (i=0;i<parameter.length;i++){
				var x = 2*i;
				var t = parameter[i].split(":");
				a[x] = t[0];
				a[x+1] = t[1];
			}
			popup(a[1]);
		}
	}
}
/*

function GetQueryString1(){
	var LocString=String(window.document.location.href);
    var rs=new RegExp("(^|)"+str+"=([^\&]*)(\&|$)","gi").exec(LocString),tmp;
    if(tmp=rs)return tmp[2];
    return null;
    }

function GetQueryString(strURL:String, strStringName:String):String {
	if (strURL == undefined || strURL == ) {
	strURL = _root._url;
	}
	var strQueryStub:String;
	strQueryStub = strURL.slice(strURL.lastIndexOf(#)+1);
	if (strStringName == undefined || strStringName == ) {
	return strQueryStub;
	}
	var nSubPosA:Number, nSubPosB:Number;
	strQueryStub = &+strQueryStub;
	nSubPosA = strQueryStub.lastIndexOf(&+strStringName+=);
	if (nSubPosA == -1) {
	return ;
	}
	nSubPosA += length(&+strStringName+=);
	nSubPosB = strQueryStub.indexOf(&, nSubPosA);
	if (nSubPosB == -1) {
	nSubPosB = strQueryStub.length;
	}
return unescape(strQueryStub.slice(nSubPosA, nSubPosB));
};*/
//var id=GetQueryString(www.csksoft.net/mypage#id=3,id);